package at.fhj.itm10.ticketmaster.entities;

import java.util.Date;

/**
 * customer model
 * 
 * @author stefan leisenberger
 */


public class Customer implements Entity {
 
	private long id;
	private String userName;
	private String password;
	private String firstName;
	private String lastName;
	private boolean male;
	private String title;
	private String eMail;
	private Date birthDate;
	private Date registerDate;
	private boolean newsletter;
	private boolean organizer;
	private boolean activated;
	private String resetKey;
	private boolean reset;

	private String activationKey;
	private long fkAddressId;
	
	public Customer(long id, String userName, String password, String firstName, String lastName, boolean male, String title,
			String eMail, Date birthDate, Date registerDate, boolean newsletter, boolean organizer, long fkAdressId, String resetKey, boolean reset) {
		this.setId(id);
		this.setUserName(userName);
		this.setPassword(password);
		this.setFirstName(firstName);
		this.setLastName(lastName);
		this.setMale(male);
		this.setTitle(title);
		this.setEmail(eMail);
		this.setBirthDate(birthDate);
		this.setRegisterDate(registerDate);
		this.setNewsletter(newsletter);
		this.setOrganizer(organizer);
		this.setFkAddressId(fkAdressId);
		this.setResetKey(resetKey);
		this.setReset(reset);
	}
	
	public Customer() {
		// empty constructor
	}
	
	// getter and setter
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public boolean isMale() {
		return male;
	}
	public void setMale(boolean gender) {
		this.male = gender;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getEmail() {
		return eMail;
	}
	public void setEmail(String eMail) {
		this.eMail = eMail;
	}
	public Date getBirthDate() {
		return (Date) birthDate.clone();
	}
	public void setBirthDate(Date birthDate) {
		this.birthDate = (Date) birthDate.clone();
	}
	public Date getRegisterDate() {
		return (Date) registerDate.clone();
	}
	public void setRegisterDate(Date registerDate) {
		this.registerDate = (Date) registerDate.clone();
	}
	public boolean isNewsletter() {
		return newsletter;
	}
	public void setNewsletter(boolean newsletter) {
		this.newsletter = newsletter;
	}
	public boolean isOrganizer() {
		return organizer;
	}
	public void setOrganizer(boolean organizer) {
		this.organizer= organizer;
	}
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public long getFkAddressId() {
		return fkAddressId;
	}
	public void setFkAddressId(long fkAddressId) {
		this.fkAddressId = fkAddressId;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public boolean isActivated() {
		return activated;
	}
	public void setActivated(boolean activated) {
		this.activated = activated;
	}
	public String getActivationKey() {
		return activationKey;
	}
	public void setActivationKey(String activationKey) {
		this.activationKey = activationKey;
	}
	public String getResetKey() {
		return resetKey;
	}
	public void setResetKey(String resetKey) {
		this.resetKey = resetKey;
	}
	public boolean isReset() {
		return reset;
	}
	public void setReset(boolean reset) {
		this.reset = reset;
	}

	/**
	 * {@inheritDoc}
	 * Returns a hashcode for the object.
	 * @return result
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (id ^ (id >>> 32));
		return result;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * Compare this object with another object.
	 * 
	 * @param obj
	 * @return boolean (true if the objects are identical). 
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Customer other = (Customer) obj;
		if (id != other.id)
			return false;
		return true;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * Returns a String with the entries from DB for customer.
	 * @return String
	 */
	@Override
	public String toString() {
		return "Customer [id=" + id + ", userName=" + userName + ", password="
				+ password + ", firstName=" + firstName + ", lastName="
				+ lastName + ", male=" + male + ", title=" + title + ", eMail="
				+ eMail + ", birthDate=" + birthDate + ", registerDate="
				+ registerDate + ", newsletter=" + newsletter + ", organizer="
				+ organizer + ", activated=" + activated + ", resetKey="
				+ resetKey + ", reset=" + reset + ", activationKey="
				+ activationKey + ", fkAddressId=" + fkAddressId + "]";
	}
}